<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl?>/css/manage/plugins/validationEngine/css/validationEngine.jquery.css" />
<div id="content">
    <div class="box">
        <div class="title">
            <h5>内容管理>语言编辑><?php echo $lang['lang'] ?></h5>
        </div>
        <?php
        if($this->actExist('Edit')){
            ?>
            <div class="viewbar tar ptr10">
                <?php $this->actPermission('<button class="btn" onclick="edit(0)">编辑</button>',"Edit");
                ?>
            </div>
        <?php
        }
        ?>
        <form action="edit" name="form_edit" id="form_edit" method="post" >
            <input type="hidden" name="langid" value="<?php echo $lang['id']; ?>"/>
            <div class="table">
                <table>
                    <thead>
                    <tr>
                        <th class="tal">类别</th>
                        <th>源文字</th>
                        <th>翻译</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    if(sizeof($messages)>0){
                        foreach ( $messages as $m ) {
                            ?>
                            <tr>
                                <td><?php echo $m['category'];?></td>
                                <td class="tac"><?php echo $m['message'];?></td>
                                <td class="tac"><input type="text" class="small validate[required] " value="<?php echo $m['translation'];?>" name="transl_<?php echo $m['id']; ?>" /></td>
                            </tr>
                        <?php
                        }
                    }
                    ?>
                    </tbody>
                </table>
            </div>
        </form>

        <?php
        if($this->actExist('Edit')){
            ?>
            <div class="viewbar tar ptr10 mgt_10">
                <?php $this->actPermission('<button class="btn" onclick="edit(0)">编辑</button>',"Edit");
                ?>
            </div>
        <?php
        }
        ?>

    </div>
</div>
<script src="<?php echo Yii::app()->request->baseUrl?>/css/manage/plugins/validationEngine/jquery.validationEngine.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl?>/css/manage/plugins/validationEngine/jquery.validationEngine-zh_CN.js"></script>
<script>
function edit(){
    if($("#form_edit").validationEngine('validate')){
        document.forms['form_edit'].submit();
    }
}
</script>